﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Data.SqlClient;
using System.Text.RegularExpressions;

namespace Framework_Tool
{
    /// <summary>
    /// Interaction logic for AssessmentView.xaml
    /// </summary>
    public partial class AssessmentView : Page
    {
        TakeAssessment takeAsmnt;

        public AssessmentView()
        {
            InitializeComponent();
        }

        private void mainContent_Loaded_1(object sender, RoutedEventArgs e)
        {
            Database.populateAsmntListview(this);
        }

        private void addAsmntBtn_Click_1(object sender, RoutedEventArgs e)
        {
            AssessmentAdd asmntAddWindow = new AssessmentAdd();
            asmntAddWindow.Content = null;
            mainContent.Children.Add(asmntAddWindow.mainContent);
        }

        private void updateAsmntBtn_Click_1(object sender, RoutedEventArgs e)
        {
            AssessmentUpdate asmntUpdateWindow = new AssessmentUpdate();
            asmntUpdateWindow.Content = null;
            mainContent.Children.Add(asmntUpdateWindow.mainContent);
        }

        private void deleteAsmntBtn_Click_1(object sender, RoutedEventArgs e)
        {
            AssessmentDelete asmntDeleteWindow = new AssessmentDelete();
            asmntDeleteWindow.Content = null;
            mainContent.Children.Add(asmntDeleteWindow.mainContent);
        }

        private void searchAsmntBtn_Click_1(object sender, RoutedEventArgs e)
        {

        }

        private void asmntView_Update_Click_1(object sender, RoutedEventArgs e)
        {
            AssessmentUpdate asmntUpdateWindow = new AssessmentUpdate();
            asmntUpdateWindow.Content = null;
            mainContent.Children.Add(asmntUpdateWindow.mainContent);

            DataRowView drv = (DataRowView)displayAsmntDetailsLstvw.SelectedItem;
            string x = drv.Row["assessmentID"].ToString();
            asmntUpdateWindow.asmntIDCmbx_updateAsmnt.Text = x;
        }

        private void asmntView_Delete_Click_1(object sender, RoutedEventArgs e)
        {
            AssessmentDelete asmntDeleteWindow = new AssessmentDelete();
            asmntDeleteWindow.Content = null;
            mainContent.Children.Add(asmntDeleteWindow.mainContent);

            DataRowView drv = (DataRowView)displayAsmntDetailsLstvw.SelectedItem;
            string x = drv.Row["assessmentID"].ToString();
            asmntDeleteWindow.asmntIDCmbx_deleteAsmnt.Text = x;
        }
        
        private void asmntView_Cancel_Click_1(object sender, RoutedEventArgs e)
        {
            displayAsmntDetailsLstvw.SelectedItem = "";
        }
    }
}
